package com.heartunderblade.rpc.factory;

import com.heartunderblade.rpc.proxy.MockServiceProxy;

import java.lang.reflect.Proxy;

public class MockServiceProxyFactory {
    /**
     * 根据服务类获取 Mock 代理对象
     * @param serviceClass
     * @param <T>
     * @return
     */
        public static <T> T  getMockProxy(Class<T> serviceClass){
            return (T)Proxy.newProxyInstance(
                    serviceClass.getClassLoader(),
                    new Class[]{serviceClass},
                    new MockServiceProxy()
            );
        }
}
